//
//  NYUserSetPwdForm.m
//  NYTYY
//
//  Created by MinLison on 2017/12/12.
//  Copyright © 2017年 NYtyy. All rights reserved.
//

#import "NYUserSetPwdForm.h"
#import "NYUserFormButtonCell.h"
#import "NYUserAgreementCell.h"
#import "NYUserFormPhoneCell.h"
#import "NYUserFormSMSCell.h"
#import "NYUserFormSubmitCell.h"
#import "NYUserSetPwdCell.h"
#import "NYSetPwdCompleteCell.h"
@implementation NYUserSetPwdForm
- (instancetype)initWithType:(NYSetPwdType)type
{
        if (self = [super init]) {
                self.type = type;
        }
        return self;
}
- (NSArray *)fields
{
        return @[
//                 @{FXFormFieldKey : @keypath(self,old_password), FXFormFieldTitle : @"旧密码", FXFormFieldCell : [NYUserSetPwdCell class], FXFormFieldPlaceholder : @"原密码"},
                 @{FXFormFieldKey : @keypath(self,password), FXFormFieldTitle : @"新密码", FXFormFieldCell : [NYUserSetPwdCell class], FXFormFieldPlaceholder : @"新密码"},
                 @{FXFormFieldKey : @keypath(self,repeatPassword), FXFormFieldTitle : @"确认密码", FXFormFieldCell : [NYUserSetPwdCell class], FXFormFieldPlaceholder : @"新密码"},
                 ];
}
- (void)setPassword:(NSString *)password
{
        _password = password;
        NYUserManager.password = password;
}
- (void)setRepeatPassword:(NSString *)repeatPassword
{
        _repeatPassword = repeatPassword;
        NYUserManager.repeat_password = repeatPassword;
}
- (void)setOld_password:(NSString *)old_password
{
        _old_password = old_password;
        NYUserManager.old_password = old_password.copy;
}

- (NSArray *)extraFields
{
        return @[
                 @{FXFormFieldTitle : @"确认修改", FXFormFieldCell : [NYSetPwdCompleteCell class], FXFormFieldAction: @"next"}
                 ];
}

- (void)dealloc
{
        NYUserManager.password = nil;
}
@end
